package com.yexiao.cofe.business.repository;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yexiao.cofe.business.mapper.OrderItemParamMapper;
import com.yexiao.cofe.business.pojo.OrderItemParam;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;

@Component
public class OrderItemParamRepository {

    @Resource
    private OrderItemParamMapper mapper;

    public List<OrderItemParam> listByOrderItemIds(List<Long> orderItemIdList) {
        if(CollectionUtil.isEmpty(orderItemIdList)){
            return Collections.emptyList();
        }

        QueryWrapper<OrderItemParam> wrapper = new QueryWrapper<>();
        wrapper.in("order_item_id", orderItemIdList);
        return mapper.selectList(wrapper);
    }
}
